<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *公告管理
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';

if($_RQ['op']=='list'){
	$fields=array('id','mid','star','groupid','isrecommand','salecate','cateid','mobile','realname','status','jointime','accounttime','logo','merchname','upass','uname');
	$params=array('status'=>1,'uniacid'=>$_SESSION['uniacid'],'upass <>'=>'','mid >'=>0);
	$return['list']=pdo_getall('jy_merch_user',$params,$fields);
	foreach($return['list'] as $k=>&$v){
		$v['total']=pdo_count('jy_xiaoeknow_user',array('isvip'=>1,'merchid'=>$v['id'],'uniacid'=>$_SESSION['uniacid']));
		$v['fee1']=pdo_getsum('jy_xiaoeknow_viporder',array('status'=>1,'merchid'=>$v['id'],'uniacid'=>$_SESSION['uniacid']),'fee');
		$v['fee2']=pdo_getsum('jy_xiaoeknow_video_order',array('ispay'=>1,'merchid'=>$v['id'],'uniacid'=>$_SESSION['uniacid']),'fee');
		$v['fee']=$v['fee1']+$v['fee2'];
	}
	paixu($return['list'],'fee','desc');
	foreach($return['list'] as $k=>&$v){
		$v['rank']=$k+1;
	}
	$htmls=array(
		'type'=>'list',
		'list'=>array('data'=>'list','delall'=>false,'del_one'=>false,'edit'=>false,'list'=>array(
			array('name'=>'rank','title'=>'排行','type'=>'string'),
			array('name'=>'merchname','title'=>'商家名称','type'=>'string'),	
			array('name'=>'total','title'=>'VIP人数','type'=>'string'),
			array('name'=>'fee','title'=>'总付费金额','type'=>'string'),
		)),
	
	);
	$return['htmls']=$htmls;
	exi($return);
}
